Original Question: In ArcView 3.2 I used a script that would add xy coordinates to a shapefile's attribute table and a script that would automatically number all of the features in a table. Does anyone know how to accomplish these two things in ArcView 8.1? Responses: (Thanks to all who responded!!!) I recieved no responses to the auto-number part of my question, the following is a summary of the responses to adding xy coordinates to an attribute table. __________ Dean Carstens (ispsgis@safcol.co.za) sent me VB code for ArcView 8.1 to add xy coordinates to an attribute table. I tried it on my machine for one of my projects and it worked great. However when I tried it on another machine on a different project ArcView froze (could be due to the large number of records in the file I was trying to add coordinates to). Here is the code: Public Sub addxy() Dim thedocument As IMxDocument Set thedocument = ThisDocument Dim thelay As ILayer Set thelay = thedocument.SelectedLayer If thelay Is Nothing Then MsgBox "Select a single point layer or point shapefile" Exit Sub End If Dim thelayer As IFeatureLayer Set thelayer = thelay Dim theFC As IFeatureClass Set theFC = thelayer.FeatureClass If TypeOf theFC Is ICoverageFeatureClass Or theFC.ShapeType <> esriGeometryPoint Then MsgBox "Select a single point layer or point shapefile" Exit Sub End If Dim xfield As IFieldEdit Dim yfield As IFieldEdit Set xfield = New Field Set yfield = New Field With xfield .Type = 3 .name = "XFIELD" End With With yfield .Type = 3 .name = "YFIELD" End With theFC.AddField xfield theFC.AddField yfield 'Dim thequeryfilter As IQueryFilter 'Set thequeryfilter = New QueryFilter 'thequeryfilter.WhereClause = "" Dim thefeaturecursor As IFeatureCursor Set thefeaturecursor = theFC.Search(Nothing, False) Dim thefeature As IFeature Set thefeature = thefeaturecursor.NextFeature While Not thefeature Is Nothing Dim theenvelope As IEnvelope Set theenvelope = thefeature.Extent Dim xcoor As Double xcoor = theenvelope.XMax Dim ycoor As Double ycoor = theenvelope.YMax Dim indexX As Long indexX = theFC.FindField("XFIELD") Dim indexY As Long indexY = theFC.FindField("YFIELD") thefeature.Value(indexX) = xcoor 'thefeature.Store thefeature.Value(indexY) = ycoor thefeature.Store Set thefeature = thefeaturecursor.NextFeature Wend End Sub __________ Dr. Arun K. Saruf (Saraffes@rurkiu.ernet.in) pointed me towards an extension (Coordinate Tool Box) that he had developed and posted on ESRI's ArcScripts page. I was unable to locate this extenstion __________ Mark Gillick (Markg@rcahms.gov.uk) sent me a link to a script to add xy coordinates http://gis.esri.com/arcscripts/details.cfm?CFGRIDKEY=578CDFF0-E0BF-11D4-943 , but I could not get the link to work. __________ ESRI suggested that I use the following: http://support.esri.com/search/KbDocument.asp?dbid=19643 __________ I also recieved some e-mails requesting the add xy coordinates script that I had used in ArcView 3.2. That script was one of the ESRI sample scripts included with ArcView. __________ Thanks again to everyone who responded! -Jessica Jessica Baker Environmental Scientist 1 Buchart-Horn, Inc. Liberty Technology Center Suite 300 2200 Liberty Ave. Pittsburgh, PA 15222-4502 phone: 412.261.5059 fax: 412.261.4168 mailto:jbaker@bh-ba.com